package com.tm.media.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tm.media.model.entity.ApUserFanEntity;
import com.tm.media.model.entity.WmFansEntity;
import com.tm.media.model.mapper.ApUserFanMapper;
import com.tm.media.model.mapper.WmFansMapper;
import com.tm.media.service.ApUserFanService;
import com.tm.media.utils.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author Ly
 * @Data 2023/3/3 9:47
 * @ClassName ApUserFanServiceImpl
 */
@Service
public class ApUserFanServiceImpl extends ServiceImpl<ApUserFanMapper, ApUserFanEntity> implements ApUserFanService {
   @Autowired
   private ApUserFanMapper apUserFanMapper;
   @Autowired
   private WmFansMapper wmFansMapper;
    @Override
    public Result apUserFanList(ApUserFanEntity apUserFanEntity) {
        IPage<WmFansEntity> iPage = new Page<WmFansEntity>(apUserFanEntity.getPage(),apUserFanEntity.getSize());
        iPage.setCurrent(apUserFanEntity.getPage());
        iPage.setSize(apUserFanEntity.getSize());
        QueryWrapper<WmFansEntity> queryWrapper = new QueryWrapper<>();
        IPage<WmFansEntity> adUserIPage = wmFansMapper.selectPage(iPage, queryWrapper);
        return Result.SUCCESS(adUserIPage);
    }
    //获取粉丝头像
    @Override
    public Result avatar(ApUserFanEntity apUserFanEntity) {
        String avatarRes = apUserFanMapper.avatar(apUserFanEntity);
        return Result.SUCCESS(avatarRes);
    }
}
